﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking.Types;

public static class TestData
{
    public static void TestCandidate(this UserInfo newInfo, long uid)
    {
        int id = (int)uid;
        newInfo.userId = id;
        newInfo.name = "用户" + id;
        newInfo.birthYear = 1992 + id;
        newInfo.birthMonth = 1 + id;
        newInfo.birthDay = 5 + id;
        newInfo.status = "积极营业";
        newInfo.xingzuo = DataString.GetXingzuoWirhDate(newInfo.birthMonth, newInfo.birthDay);
        newInfo.locationCity = "深圳";
        newInfo.hometownCity = "广东韶关";
        newInfo.job = "财务";
        newInfo.company = "上市公司";
        newInfo.eduation = Mathf.Clamp(id, 0, 4);
        newInfo.school = "北京大学";
        newInfo.height = 157 + id;
        newInfo.weight = 47 + id;
        newInfo.income = 2000 * id;
        newInfo.realNameVerify = id % 2 == 0 ? true : false;
        newInfo.jobVerify = id % 2 == 0 ? true : false;
        newInfo.eduVerify = id % 2 == 0 ? true : false;
        newInfo.aboutMe = "性格沉稳，随和，在陌生环境里话会少一点，比较\r\n安静，在熟悉的环境和熟人面前话会比较多，说说\r\n笑笑打打闹闹。";
        newInfo.familyBackground = "普通家庭，上有哥哥一枚，本科已婚有娃，父母比\r\n较开明随和，也是没什么事的人";
        newInfo.interest = "业余时间看电影，看看书，有压力的时候，放着电\r\n视剧收拾房间。周末约朋友去爬山徒步，也会研究\r\n一些美食，厨艺还在进修中，成果还不做，在做饭\r\n这一块，自认为还是有点天赋的，看一遍教程，做\r\n出来的不会特别难吃舍";
        newInfo.loveView = "能互相理解，包容，心甘情愿的成就彼此的开心\r\n快乐。感情是两个人的事，双方都共同付出经营才\r\n有可能走的长远。所以在感情中一定要善于沟通\r\n且多沟通!!!";
        newInfo.idealCompanion = "希望你是个有责任心的人，积极上进，对待感情认\r\n真负责。对会在细节上照顾人的男生比较好有好\r\n感，不大男子主义，踏实靠谱，对感情专一\r\n当然最重要的是聊得来，在彼此跟前可以毫无顾忌\r\n的说废话，相处状态舒适无压力。\r\n希望不斤斤计较爱生闷气，有问题可以指出来及时\r\n沟通。\r\n最后无不良嗜好，不赌博";
        newInfo.icon = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidateIcon(id).texture),512,512);
        newInfo.tex1 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture),800,600);
        newInfo.tex2 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture), 800, 600);
        newInfo.tex3 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture), 800, 600);
        newInfo.tex4 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture), 800, 600);
        newInfo.tex5 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture), 800, 600);
        newInfo.tex6 = null;//new Tex(GetTexBytes(GameResourceManager.LoadCandidatePhoto(id).texture), 800, 600);
    }

    public static byte[] GetTexBytes(Texture2D tex)
    {
        return new byte[0];
    }

    public static Texture2D NewCopyTex(Texture2D tex)
    {
        Texture2D result = new Texture2D(tex.width, tex.height, TextureFormat.RGB24, true);
        Color[] rpixels = result.GetPixels(0);

        result.SetPixels(rpixels, 0);
        result.Apply();

        NewTextureController.instance.AddNewTexture(result, null);

        return result;
    }

    public static void TestUserMoment(this UserMoment userMoment, long uid)
    {
        int id = (int)uid;
        //userMoment.userId = id;
        //userMoment.name = "用户" + id;
        //userMoment.job = "财务";
        //userMoment.locationCity = "深圳";
        //userMoment.birthYear = 1992+id;
        //userMoment.height = 156+id;
        //userMoment.eduation = 2;
        //int icon = Mathf.Clamp(id, 1, 6);
        //userMoment.icon = new Tex(GetTexBytes(GameResourceManager.LoadCandidateIcon(icon).texture),512,512);
        Moment moment = new Moment();
        moment.TestMoment(uid);

        userMoment.moment = moment;
    }

    public static void TestMoment(this Moment moment, long uid)
    {
        int id = (int)uid;

        moment.userId = uid;
        moment.time = UnityFunctions.GetTimeStampSeconds();
        moment.content = "今天的动态今天的动态今天的动态今天的动态今天的动态今天的动态今天的动态今天的动态" + id;
        moment.location = "深圳龙华";
        moment.topic = id % 2 == 0 ? "" : "30天挑战";
        List<Tex> texes = new List<Tex>();
        for (int i = 0; i < id; i++)
        {
            int photo = Mathf.Clamp(i, 1, 6);
            var tex = GetTexBytes(GameResourceManager.LoadCandidatePhoto(photo).texture);
            //texes.Add(new Tex() { tex = tex, texWidth = 800, texHeight = 600 });
        }
        //moment.texs = texes.ToArray();
    }
}
